import Vue from 'vue'
import Router from 'vue-router';
import server from '@/page/manage/server/server'
import message from '@/page/manage/message/message'
import quiz from '@/page/quiz/quiz'
import quizDetial from '@/page/quiz/quizDetial'
import tableDataQuiz from '@/page/quiz/tableDataQuiz'
import conclusion from '@/page/conclusion/conclusion'
import performance from '@/page/performance/performance'
import user from '@/page/user/user'
import userMessage from '@/page/base/login/register'
import quizResult from '@/page/quizResult/quizResult'
import quizResultCustom from '@/page/quizResult/quizResultCustom'
import dataResult from '@/page/dataResult/dataResult'


Vue.use(Router);
const routerConfig = [
    {
        path: '/',
        name: '首页',
        redirect: '/server',
        icon: 'el-icon-menu'
    },
    // {
    //     path: '/server',
    //     name: '服务器管理',
    //     icon: 'el-icon-menu',
    //     component: server,
    //     meta: {
    //         requireAuth: true, // 判断是否需要登录
    //     },
    // },
    // {
    //     path: '/message',
    //     name: '消息管理',
    //     icon: 'el-icon-menu',
    //     component: message,
    //     meta: {
    //         requireAuth: true, // 判断是否需要登录
    //     },
    // },
    {
        path: '/quiz',
        name: '实验列表',
        icon: 'el-icon-menu',
        component: quiz,
        meta: {
            requireAuth: true, // 判断是否需要登录
        },
    },
    {
        path: '/conclusion',
        name: '学生结论和表现',
        icon: 'el-icon-menu',
        component: conclusion,
        meta: {
            requireAuth: true, // 判断是否需要登录
        },
        hidden: localStorage.isAdmin !== undefined ? !JSON.parse(localStorage.isAdmin) : false
    },
    {
        path: '/performance',
        name: '实验数据',
        icon: 'el-icon-menu',
        component: performance,
        meta: {
            requireAuth: true, // 判断是否需要登录
        },
        hidden: localStorage.isAdmin !== undefined ? !JSON.parse(localStorage.isAdmin) : false
    },
    {
        path: '/user',
        name: '学生信息',
        icon: 'el-icon-menu',
        component: user,
        // hidden: true,
        meta: {
            requireAuth: true, // 判断是否需要登录
        },
        hidden: localStorage.isAdmin !== undefined ? !JSON.parse(localStorage.isAdmin) : false
    },{
        path: '/quizDetial',
        name: '实验详情',
        icon: 'el-icon-menu',
        component: quizDetial,
        hidden: true,
        meta: {
            requireAuth: true, // 判断是否需要登录
        }
    },
    {
        path: '/tableDataQuiz',
        name: '实验报告',
        icon: 'el-icon-menu',
        component: tableDataQuiz,
        hidden: true,
        meta: {
            requireAuth: true, // 判断是否需要登录
        }
    },
    {
        path: '/register',
        name: '我的信息',
        icon: 'el-icon-menu',
        component: userMessage,
        meta: {
            requireAuth: true, // 判断是否需要登录
        },
        hidden: true
    },
    {
        path: '/quizResult',
        name: '我的成绩',
        icon: 'el-icon-menu',
        component: quizResult,
        meta: {
            requireAuth: true, // 判断是否需要登录
        },
        hidden: true
    },
    {
        path: '/quizResultCustom',
        name: '学生成绩',
        icon: 'el-icon-menu',
        component: quizResultCustom,
        meta: {
            requireAuth: true, // 判断是否需要登录
        },
        hidden: localStorage.isAdmin !== undefined ? !JSON.parse(localStorage.isAdmin) : false
    },
     {
        path: '/dataResult',
        name: '实验数据',
        icon: 'el-icon-menu',
        component: dataResult,
        meta: {
            requireAuth: true, // 判断是否需要登录
        },
         hidden: localStorage.isAdmin !== undefined ? JSON.parse(localStorage.isAdmin) : false
    },
]
// const router = new Router({
//     mode: 'history',
//     routes: routerConfig
// })
export default new Router({
    mode: 'history',
    routes: routerConfig
})
//export的语法，可以先定义变量，然后再export {要导出的变量}
//第二种方法： exports.变量名 = ......
